<?php

include_once('logic/view/View.php');

class UpdateView extends View
{
    private	$_photos;
    
    // admin
    function __construct()
    {
	parent::__construct("ADMINISTRATOR");
	$this->_xsl_template = 'template/update_template.xsl';
		
	// create the photos element
	$this->_photos = $this->_root->appendChild($this->_xml_doc->createElement('photos'));
	
	// <photos>
	// ...
	// </photos>
    }

    function addTableEntry($id, $title, $date, $description)
    {
	// <photo>
	//   <id>$id</id>
	//   <title>$title</title>
	//   <date>$date</date>
	//   <description>$description</description>
	// </photo>
 	
	$photo = $this->_xml_doc->createElement('photo');
        $this->_photos->appendChild($photo);
    	
	$id_node = $photo->appendChild($this->_xml_doc->createElement('id'));
	$id_node->appendChild($this->_xml_doc->createTextNode($id));
	
	$title_node = $photo->appendChild($this->_xml_doc->createElement('title'));
	$title_node->appendChild($this->_xml_doc->createTextNode($title));

	$date_node = $photo->appendChild($this->_xml_doc->createElement('date'));
	$date_node->appendChild($this->_xml_doc->createTextNode($date));

	$description_node = $photo->appendChild($this->_xml_doc->createElement('description'));
	$description_node->appendChild($this->_xml_doc->createTextNode($description));
    }
}

?>
